#coding=utf-8

__author__ = 'Huang Yuan Yuan'
import os
from celery import Celery

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'videosite.settings')

app = Celery('videosite.videosite')

# Using a string here means the worker don't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
#   should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings')  # 这个CELERY ，表示以后在django的settings.py文件中，celery的配置变量，都是以 "CELERY_" 开头的。

# Load task modules from all registered Django app configs.
app.autodiscover_tasks('django.conf:settings')


@app.task(bind=True)
def debug_task(self):
    print('Request: {0!r}'.format(self.request))